home *** CD-ROM | disk | FTP | other *** search
- class Bounds
- {
- static var §#29§ = 1;
- function Bounds()
- {
- }
- static function getXMin()
- {
- if(Bounds.xmin == undefined)
- {
- Bounds.xmin = Math.round(_root.bounds.getBounds(_root).xMin);
- }
- return Bounds.xmin;
- }
- static function getXMax()
- {
- if(Bounds.xmax == undefined)
- {
- Bounds.xmax = Math.round(_root.bounds.getBounds(_root).xMax);
- }
- return Bounds.xmax;
- }
- static function getYMin()
- {
- if(Bounds.ymin == undefined)
- {
- Bounds.ymin = Math.round(_root.bounds.getBounds(_root).yMin);
- }
- return Bounds.ymin;
- }
- static function getYMax()
- {
- if(Bounds.ymax == undefined)
- {
- Bounds.ymax = Math.round(_root.bounds.getBounds(_root).yMax);
- }
- return Bounds.ymax;
- }
- static function toString()
- {
- var _loc2_ = _root.bounds.getBounds(_root);
- return "xMin=" + Math.round(_loc2_.xMin) + ", xMax=" + Math.round(_loc2_.xMax) + ", yMin=" + Math.round(_loc2_.yMin) + ", yMax=" + Math.round(_loc2_.yMax);
- }
- static function §#469§()
- {
- var _loc4_ = new Object();
- _loc4_.onMouseDown = function()
- {
- var _loc3_ = _root._xmouse;
- var _loc2_ = _root._ymouse;
- eval("#0").log("mouse x=" + _loc3_ + ", y=" + _loc2_ + ", in bounds: " + Bounds["#366"](_loc3_,_loc2_) + ", x bound: " + Bounds["#118"](_loc3_,_loc2_) + ", y bound: " + Bounds["#119"](_loc3_,_loc2_));
- };
- Mouse.addListener(_loc4_);
- }
- static function §#366§(x, y)
- {
- return _root.bounds.hitTest(x,y,true);
- }
- static function §#177§(mc)
- {
- var _loc3_ = mc.getBounds(_root).xMin;
- var _loc2_ = mc.getBounds(_root).yMin;
- if(!_root.bounds.hitTest(_loc3_,_loc2_,true))
- {
- return false;
- }
- _loc3_ = mc.getBounds(_root).xMax;
- _loc2_ = mc.getBounds(_root).yMax;
- if(!_root.bounds.hitTest(_loc3_,_loc2_,true))
- {
- return false;
- }
- return true;
- }
- static function §#216§(mc)
- {
- if(Bounds["#177"](mc))
- {
- return undefined;
- }
- var _loc2_ = mc.getBounds(_root);
- _loc2_["#289"] = (_loc2_.xMin + _loc2_.xMax) / 2;
- _loc2_["#290"] = (_loc2_.yMin + _loc2_.yMax) / 2;
- var _loc3_ = Bounds["#119"](_loc2_["#289"],_loc2_.yMin);
- if(_loc2_.yMin < _loc3_)
- {
- mc._y += _loc3_ - _loc2_.yMin;
- }
- _loc3_ = Bounds["#119"](_loc2_["#289"],_loc2_.yMax);
- if(_loc2_.yMax > _loc3_)
- {
- mc._y += _loc3_ - _loc2_.yMax;
- }
- _loc3_ = Bounds["#118"](_loc2_.xMin,_loc2_["#290"]);
- if(_loc2_.xMin < _loc3_)
- {
- mc._x += _loc3_ - _loc2_.xMin;
- }
- _loc3_ = Bounds["#118"](_loc2_.xMax,_loc2_["#290"]);
- if(_loc2_.xMax > _loc3_)
- {
- mc._x += _loc3_ - _loc2_.xMax;
- }
- }
- static function §#118§(x, y)
- {
- var _loc6_ = Bounds.getYMin();
- if(y < _loc6_)
- {
- y = _loc6_ + 1;
- }
- var _loc5_ = Bounds.getYMax();
- if(y > _loc5_)
- {
- y = _loc5_ - 1;
- }
- var _loc3_ = _root.background._width / 2;
- while(!_root.bounds.hitTest(x,y,true))
- {
- if(x > _loc3_)
- {
- x -= Bounds["#29"];
- if(x <= _loc3_)
- {
- return undefined;
- }
- }
- else
- {
- x += Bounds["#29"];
- if(x >= _loc3_)
- {
- return undefined;
- }
- }
- }
- return x;
- }
- static function §#119§(x, y)
- {
- var _loc6_ = Bounds.getXMin();
- if(x < _loc6_)
- {
- x = _loc6_ + 1;
- }
- var _loc5_ = Bounds.getXMax();
- if(x > _loc5_)
- {
- x = _loc5_ - 1;
- }
- var _loc3_ = _root.background._height * 0.8;
- while(!_root.bounds.hitTest(x,y,true))
- {
- if(y > _loc3_)
- {
- y -= Bounds["#29"];
- if(y <= _loc3_)
- {
- return undefined;
- }
- }
- else
- {
- y += Bounds["#29"];
- if(y >= _loc3_)
- {
- return undefined;
- }
- }
- }
- return y;
- }
- }
-